package com.free.mini.common.base;

import java.io.Serializable;

import lombok.Data;
/**
 * {
 * "appVersion":"1.0.10",
 * "city":"",
 * "signature":"7c41b60c0af9009476fe72c1e181f29a",
 * "latitude":"39.909798",
 * "uuid":"U_20c7add604364740b3ac870af02448f8",
 * "appVersionCode":"124",
 * "platform":"android",
 * "network":"5",
 * "isGoogleService":"1",
 * "noise":"aA1HRpJ8GqeZploPDfYqaezN",
 * "model":"Mi Note 3",
 * "fcmToken":"fPmFEELEKpM:APA91bGLEWFhpdV_FigYlisMxy5U_5bxiEcGhArGrup5U6IQY4eDQLwF6dJQE1-nXVgV54Bc9qFQ7hwzaHVNYRVc3TvkkwlVISFehaRNvXSY5zfSL1r-gJnN5TmZNqRxsyjHeoXNUvxu",
 * "brand":"Xiaomi",
 * "isSimulator":"0",
 * "longitude":"116.416796",
 * "systemLanguage":"en",
 * "traceId":"03231131042_20914_ANDROID",
 * "os":"android 8.1.0",
 * "appsflyerId":"1584932885287-8003525929401879788",
 * "timeZone":"Asia/Shanghai",
 * "uiVersion":"11000",
 * "accessToken":"12817a3bc9bd8f2db42c209969739df7",
 * "requestTime":"1584934264224",
 * "imei":"867392036521600",
 * "cid":"104488"
 * }
 */
@Data
public class APPRequestData implements Serializable, ToJSON {
    private static final long serialVersionUID = 1L;

    /**
     * 签名
     */
    private String signature;
    /**
     * 链路id
     */
    private String traceId;
    /**
     * app版本
     */
    private String appVersion;
    /**
     * 平台，小程序、ios
     */
    private String platform;
    /**
     * 系统
     */
    private String os;
    /**
     * 手机串码
     */
    private String imei;
    /**
     * 型号
     */
    private String model;
    /**
     * 品牌
     */
    private String brand;
    /**
     * 精度
     */
    private String longitude;
    /**
     * 维度
     */
    private String latitude;
    /**
     * 城市
     */
    private String city;
    /**
     * 时区
     */
    private String timeZone;
    /**
     * 请求唯一号，用来防重复提交
     */
    private String noise;
    /**
     * 请求时间
     */
    private String requestTime;
    /**
     * token
     */
    private String token;
    /**
     * 版本号纯数字
     */
    private String appVersionCode;
    /**
     * ui版本
     */
    private String uiVersion;
    /**
     * 来源
     */
    private String stemFrom;
    /**
     * ip
     */
    private String ip;

    /**
     * 语音
     */
    private String appLanguage;
    /**
     * 手机号
     */
    private String mobile;


    //默认经度
    public void setLongitude(String longitude) {
        if (longitude == null || longitude.length() == 0) {
            this.longitude = "0";
        } else {
            try {
                String[] tmp = longitude.split("\\.");
                if (tmp[1].length() > 6) {
                    longitude = tmp[0] + "." + tmp[1].substring(0, 6);
                }
            } catch (Exception e) {
            }
            this.longitude = longitude;

        }
    }

    //默认纬度
    public void setLatitude(String latitude) {
        if (latitude == null || latitude.length() == 0) {
            this.latitude = "0";
        } else {
            try {
                String[] tmp = latitude.split("\\.");
                if (tmp[1].length() > 6) {
                    latitude = tmp[0] + "." + tmp[1].substring(0, 6);
                }
            } catch (Exception e) {
            }
            this.latitude = latitude;
        }
    }

}